package com.celesea.auth.user.vo;

import com.celesea.auth.user.v1.controller.request.PageRequest;
import com.celesea.framework.dao.TenantFilterAdapter;
import com.celesea.framework.util.Const;
import com.celesea.framework.util.EnvUtil;
import com.celesea.framework.util.StringKit;

/**
 * @author JackYuan
 * @create 2017-10-26 23:40
 */
public class UserFilter extends TenantFilterAdapter {

    public static final String DEPT = "dept";
    private String deptId;
    private String gradeId;
    private String groupId;
    private String py;
    private Byte statusFlag;
    private Byte deleteFlag;
    private String dimension;

    public UserFilter(PageRequest request) {
        super(EnvUtil.getTenantId());
        if (DEPT.equals(request.getDimension()) && StringKit.isEmpty(request.getDeptId())) {
            this.deptId = EnvUtil.getCompany();
        } else {
            this.deptId = request.getDeptId();
        }
        this.gradeId = request.getGradeId();
        this.groupId = request.getGroupId();
        this.statusFlag = request.getStatusFlag();
        this.dimension = request.getDimension();
        this.py = request.getPy();
        this.deleteFlag = Const.DeleteFlag.NORMAL;
    }

    public UserFilter(String deptId) {
        super(EnvUtil.getTenantId());
        this.deptId = deptId;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public String getPy() {
        return py;
    }

    public void setPy(String py) {
        this.py = py;
    }

    public Byte getStatusFlag() {
        return statusFlag;
    }

    public void setStatusFlag(Byte statusFlag) {
        this.statusFlag = statusFlag;
    }

    public Byte getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(Byte deleteFlag) {
        this.deleteFlag = deleteFlag;
    }

    public String getGradeId() {
        return gradeId;
    }

    public void setGradeId(String gradeId) {
        this.gradeId = gradeId;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public String getDimension() {
        return dimension;
    }

    public void setDimension(String dimension) {
        this.dimension = dimension;
    }
}
